/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main.controller;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import main.models.CreatedGame;
import main.models.Hall;
import main.models.Player;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ManagedProperty;

/**
 *
 * @author Ariman
 */
@ManagedBean
@SessionScoped
public class HallController {

    @ManagedProperty (value = "#{hall}")
    private Hall hall;
    @ManagedProperty (value = "#{player}")
    private Player player;

    public HallController() {
    }

    
    /**
     * Redirect to home page
     *
     * @param facesContext - instance of current FacesContext.
     * @param url - relative path to security error page 
     */
    private void redirectToPage(FacesContext facesContext, String url) {
        // Redirect to home page.
        HttpServletResponse response = (HttpServletResponse) facesContext
                .getExternalContext().getResponse();

        // Extract current request
        HttpServletRequest request = (HttpServletRequest) facesContext
                .getExternalContext().getRequest();

        try {
            response.sendRedirect(request.getContextPath()+url);
        } catch (IOException ioEx) {
             Logger.getLogger(HallController.class.getName()).log(Level.SEVERE, null, ioEx);
        }

        // Skip processing of JSF chain
        facesContext.responseComplete();
    }

    public String CreateGame(){
        //hall.CreateGame(player);
        return "conventionsSelect";
    } 
    
    public Hall getHall() {
        return hall;
    }

    public void setHall(Hall hall) {
        this.hall = hall;
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }
}
